package com.hisan.freeride.home.adapter;

import android.net.Uri;
import android.view.View;
import android.widget.ImageView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.github.library.BaseQuickAdapter;
import com.github.library.BaseViewHolder;

import com.hisan.freeride.R;
import com.hisan.freeride.common.utils.CollectionUtils;
import com.hisan.freeride.home.model.LoveCartModel;


import java.util.List;

/**
 * 爱心车主列表适配器
 * Created by yu on 2017/1/17.
 */

public class Love_CartAdapter extends BaseQuickAdapter<LoveCartModel,BaseViewHolder> {

    public Love_CartAdapter(List<LoveCartModel> data) {
        super(R.layout.love_cart_item,data);
    }


    @Override
    protected void convert(BaseViewHolder holder, LoveCartModel item) {
        if (!CollectionUtils.isNullOrEmpty(item.getDriver_avatar())){
            Uri uri = Uri.parse(item.getDriver_avatar());
            SimpleDraweeView simpleDraweeView= holder.getView(R.id.logo);
            simpleDraweeView.setImageURI(uri);
        }
        holder.setText(R.id.name, item.getRealname());
        ImageView view= holder.getView(R.id.sex);
        if (!CollectionUtils.isNullOrEmpty(item.getDriver_sex())){
            if (item.getDriver_sex().equals("保密")){
                view.setVisibility(View.GONE);
            }else if (item.getDriver_sex().equals("男")){
                view.setImageResource(R.mipmap.male);
            }else if (item.getDriver_sex().equals("女")){
                view.setImageResource(R.mipmap.female);
            }
        }
        holder.setText(R.id.id, item.getUser_id()+"");
        holder.setText(R.id.score, item.getHelp_count()+"");
    }
}
